/**
 * Copyright (C) 2013 SHANGHAI VOLKSWAGEN, All rights reserved.
 * License version 1.0, a copy of which has been included with this.
 *
 * @File name：com.market.test.server.controller.ExcelController
 * @Create on：2024/3/11
 * @Author：liuchang
 */
package com.market.test.server.controller;

import com.market.test.common.domain.ExcelData;
import com.market.test.server.service.ExcelService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * <p>ClassName：ExcelController</p >
 * <p>Description：</p >
 * <p>Author：liuchang</p >
 * <p>Date：2024/3/11</p >
 */
@RestController
@Log4j2
@RequestMapping("/excel")
public class ExcelController {
    @Autowired
    private ExcelService excelService;
    @PostMapping("/easyImport")
    public void easyImport(MultipartFile file) throws IOException {
        long start = System.currentTimeMillis();
        excelService.easyImport(file);
         log.info("用时"+(System.currentTimeMillis()-start)/1000+"s");
    }
    @PostMapping("/easyExport")
    public void easyExport(HttpServletResponse response) throws IOException {
      excelService.easyExport(response);

    }
}
